//
//  ViewController.m
//  BoxPath
//
//  Created by 杨康 on 2017/12/13.
//  Copyright © 2017年 杨康. All rights reserved.
//

#import "ViewController.h"
// 非备份设置代码如下
// 需要导入

#include <sys/xattr.h>
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
     // 获取沙盒主目录路径
    NSString *homeDir= NSHomeDirectory();
    
    //一 获取Documents目录路径
    NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
    
    //二 获取Library的目录路径
    NSString *libDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
    
    
    // 获取Caches目录路径
    NSString *cachesDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
    
    // 获取Preferences目录路径
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    NSString *preferences = [[paths firstObject] stringByAppendingString:@"/Preferences"];
    
    
    //三 获取tmp目录路径
    NSString *tmpDir = NSTemporaryDirectory();
    
    //四 SystemData
}

- (BOOL)addShipBackUpAttributeToUrl:(NSString *)url {
NSURL *itemUrl = [NSURL URLWithString:url];
const char *filePath = [[itemUrl path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;

int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
